<script setup>
import { ref } from 'vue'

defineProps({
  feedbackInfo: {
    type: Object,
  },
})

const showModal = ref(false)
defineExpose({
  showModal,
})
</script>

<template>
  <el-dialog destroy-on-close v-model="showModal" title="反馈详情" width="500">
    <el-scrollbar height="400px">
      <div class="feedback-check">
        <div class="feedback-info">
          <div class="feedback-basic-info">
            <div class="feedback-info-title">基本信息</div>
            <div class="feedback-basic-info-key">反馈ID</div>
            <div>{{ feedbackInfo.id }}</div>
            <div class="feedback-basic-info-key">反馈类型</div>
            <div>
              <el-tag effect="light" round v-if="feedbackInfo.feedbackType === 0" type="primary">功能建议</el-tag>
              <el-tag effect="light" round v-if="feedbackInfo.feedbackType === 1" type="success">问题反馈</el-tag>
              <el-tag effect="light" round v-if="feedbackInfo.feedbackType === 2" type="danger">投诉举报</el-tag>
              <el-tag effect="light" round v-if="feedbackInfo.feedbackType === 3" type="warning">其他</el-tag>
            </div>
            <div class="feedback-basic-info-key">提交时间</div>
            <div style="font-size: 14px; color: #1d2109">{{ feedbackInfo.feedbackTime }}</div>
            <div class="feedback-basic-info-key">处理状态</div>
            <div>
              <el-tag effect="light" v-if="feedbackInfo.feedbackStatus === 0" type="success">已处理</el-tag>
              <el-tag effect="light" v-else type="danger">等待处理</el-tag>
            </div>
          </div>
          <div class="feedback-user-info">
            <div class="feedback-info-title">用户信息</div>
            <div class="user-info">
              <img :src="feedbackInfo.userAvatar" alt="" />
              <div class="user-info-right">
                <div class="user-info-name">{{ feedbackInfo.userName }}</div>
                <div class="user-info-phone">{{ feedbackInfo.userPhone }}</div>
              </div>
            </div>
          </div>
        </div>
        <div class="feedback-content-title">反馈内容</div>
        <div class="feedback-content">{{ feedbackInfo.feedbackContent }}</div>
      </div>
    </el-scrollbar>
    <template #footer>
      <el-button type="primary" @click="showModal = false"> 关闭</el-button>
    </template>
  </el-dialog>
</template>

<style scoped lang="scss">
.feedback-info-title {
  font-size: 14px;
  color: #999;
  margin-bottom: 10px;
}
.feedback-info {
  display: flex;
  .feedback-basic-info {
    width: 40%;
    display: flex;
    flex-direction: column;
    row-gap: 10px;
    .feedback-basic-info-key {
      font-size: 12px;
      color: #666;
    }
  }
  .feedback-user-info {
    flex: 1;
  }
}
.feedback-content {
  background-color: #f9fafb;
  padding: 20px;
  border-radius: 10px;
  margin-top: 10px;
}
.feedback-content-title {
  margin-top: 10px;
}
.user-info {
  display: flex;
  align-items: center;
  padding-top: 10px;
  box-sizing: border-box;
  img {
    width: 32px;
    height: 32px;
  }
  .user-info-right {
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    .user-info-name {
      font-size: 14px;
      color: #1d2129;
    }
    .user-info-phone {
      font-size: 12px;
      color: #999;
    }
  }
}
</style>
